import h from './myVertualDom/h'
import patch from './myVertualDom/patch'

const myVnode1 = h('section', {}, [
  h('p', { key: 'A' }, 'A'),
  h('p', { key: 'B' }, 'B'),
  h('p', { key: 'C' }, 'C'),
])

const container = document.getElementById('container')
const btn = document.getElementById('btn')

//第一次上树
patch(container, myVnode1)

//新节点
const myVnode2 = h('section', {}, [
  h('p', { key: 'A' }, 'A'),
  h('p', { key: 'B' }, 'B'),
  h('p', { key: 'M' }, 'M'),
  h('p', { key: 'N' }, 'N'),
  h('p', { key: 'C' }, 'C'),
])
btn.onclick = function () {
  patch(myVnode1, myVnode2)
}
